package com.tanhua.admin.task;

import cn.hutool.bloomfilter.filter.SDBMFilter;
import com.tanhua.admin.service.AnalysisService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

@Component
public class AnalysisTask {

    @Autowired
    private AnalysisService analysisService;

    //@Scheduled(cron = "0/5 * * * * ?")
    @Scheduled(cron = "0 0 0/1 * * ?")
    public void analysis() throws ParseException {
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        String now = simpleDateFormat.format(new Date());
        System.out.println("当前时间是:"+now);

        //完成业务需求，每隔一个小时，就将状态表Log中的数据填充到统计表当中
        analysisService.analysis();
    }
}
